<?php
/**
 * Created by PhpStorm.
 * User: krystal
 * Date: 2019/3/15
 * Time: 13:57
 */

namespace app\common\model;


use think\Model;

/**
 * 课程浏览统计模型
 * Class ZhunleCourseSectionInfo
 * @package app\common\model
 */
class ZhunleCourseSectionInfo extends Model
{
    protected $table = 'wechat_backup_07_18_14_43_00.zhunle_course_section_info';


    /**
     * 添加课程浏览记录
     * @param array $map
     * @return bool
     */
    public function save_section_info($map = [])
    {
        $uid = $map['uid'];
        $cid = $map['cid'];

        $arr = [
            'cid' => $cid,
            'uid' => $uid
        ];

        try
        {
            $this->save($arr);
        }
        catch (\Exception $e)
        {
            \think\Log::write('统计用户浏览次数失败' . $e->getMessage(), 'error', true);
        }

        return true;
    }

}
